import { View } from "../../../mvc/core/View";
import { IToolTipItem } from "../../../../com/mui/manager/IToolTipItem";
import { ToolTipsManager } from "../../../../com/mui/manager/ToolTipsManager";
import { SWFPlayer } from "../../scene/modle/SWFPlayer";
import { ModelType } from "../../scene/modle/data/ModelType";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { Cache } from "../../cache/Cache";
import { ToolTipInfo } from "../../model/ToolTipInfo";
import { Tooltip } from "../common/tooltip/Tooltip";
import { GLabel } from "../../../../com/mui/controls/GLabel";
type int = number;
//class FriendBlessExpBottleButton
    
    export  class FriendBlessExpBottleButton extends View implements IToolTipItem
    {
        constructor()
        {
            super();
            this.createChildren();
            this.buttonMode = true;
            this.addEventListener(flash.events.MouseEvent.CLICK, this.onButtonClick);
            ToolTipsManager.register(this);
            return;
        }

        /* internal  */createChildren(): void
        {
            this._expClip = new SWFPlayer();
            this._expClip.move(22, 80);
            addChild(this._expClip);
            this._expClip.loadComplete = this.onFriendBlessExpBottleButtonLoaded;
            this._expClip.load("FriendBlessExpBottleButton.swf", ModelType.NormalSwf, null);
            if (this._expClip.movieClipData) 
            {
                this._expClip.movieClipData.isClear(false);
            }
            this._label = ObjCreate.createLabel(Language.getString(69411), -10, 76, 71, 20, flash.text.TextFormatAlign.CENTER, this, true, GlobalStyle.color6Uint);
            this._label.mouseEnabled = false;
            this._label.mouseChildren = false;
            return;
        }

        /* internal  */onFriendBlessExpBottleButtonLoaded(arg1: SWFPlayer): void
        {
            this._expClip.timeRate = 10;
            this._expClip.play();
            return;
        }

        /* internal  */onButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FriendBless_ExpBottleButtonClick));
            return;
        }

        public get toolTipData()
        {
            var loc1=HTMLUtil.addColor(Language.getString(69412), GlobalStyle.color1);
            loc1 = loc1 + HTMLUtil.addColor("" + Cache.instance.friendBless.bottleInfo.exp, GlobalStyle.color1);
            return new ToolTipInfo(Tooltip.ToolTipRenderType_Text, loc1);
        }

        public set toolTipData(arg1)
        {
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            if (this._expClip.movieClipData) 
            {
                this._expClip.movieClipData.isClear(true);
            }
            this._expClip.dispose();
            ToolTipsManager.unregister(this);
            return;
        }

        /* internal */ /* var */_expClip: SWFPlayer;

        /* internal */ /* var */_label: GLabel;
    }
